package com.cyc.common.enums;

import lombok.Getter;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;

/**
 * @author chenyunchang
 * @title
 * @date 2020/6/2 19:34
 * @Description: 广告位置枚举类
 */
@Getter
public enum AdPositionEnum {

    CHANGE_SCREEN(1, "刷屏机首页轮播"),
    IPAD_LEFT_FIRST(2, "ipad优惠活动左一"),
    TV_LEFT_FIRST(3, "智能TV优惠活动左一"),
    WATER_BRAND(4, "水牌优惠活动文字链"),
    TV_HOME(5, "智能电视首页广告"),
    CLOUD_MINI_PRO(6, "云店小程序");
    /*位置编码*/
    private Integer code;
    /*位置名称*/
    private String name;

    AdPositionEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * 获取广告位置集合Map
     *
     * @return
     */
    public static HashMap<Integer, String> getAdPositionMap() {
        HashMap<Integer, String> map = new HashMap<>();
        for (AdPositionEnum adPositionEnum : EnumSet.allOf(AdPositionEnum.class)) {
            map.put(adPositionEnum.code, adPositionEnum.name);
        }
        return map;
    }

    /**
     * 获取广告位置集合List
     *
     * @return
     */
    public static List<HashMap<String, String>> getAdPositionList() {
        List<HashMap<String, String>> list = new ArrayList<>();
        for (AdPositionEnum adPositionEnum : EnumSet.allOf(AdPositionEnum.class)) {
            HashMap<String, String> map = new HashMap<>();
            map.put("code", adPositionEnum.code.toString());
            map.put("name", adPositionEnum.name);
            list.add(map);
        }
        return list;
    }
}
